//
//  AppDelegate.m
//  Rabbit
//
//  Created by 阿帕 on 2018/11/2.
//  Copyright © 2018年 GCY. All rights reserved.
//

#import "AppDelegate.h"
#import "MCTabBarController.h"
#import "XPRootNavigationController.h"

#import "HuoYuanDetailViewController.h"
#import "HuoYuanDetailViewController.h"
#import "YunDanCenterTabbar.h"
#import "YunDanCenterDetailViewController.h"
#import "NoticeMessageViewController.h"
#import "CJCheckVersion.h"
#import <AMapSearchKit/AMapSearchKit.h>


// 引入 JPush 功能所需头文件
#import "JPUSHService.h"
#import "JANALYTICSService.h"
// iOS10 注册 APNs 所需头文件
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
#import <UserNotifications/UserNotifications.h>
#endif

#ifdef isOpenBaiDuFaceSDK
#import "IDLFaceSDK/IDLFaceSDK.h"
#import "FaceParameterConfig.h"
#import "BDFaceLivingConfigModel.h"
#endif

@interface AppDelegate ()<JPUSHRegisterDelegate>

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    KEYBOARDMANAGER
    
#ifdef isProductionEnvironment
    [ReAddressDynamic shared].baseUrl = BasicDomainURL;
#else
    if (![[UserDefaultUtil valueForKey:@"BASEREADDRESS"] isNotBlank]) {
        [ReAddressDynamic shared].baseUrl = BasicDomainURL;
    } else {
        [ReAddressDynamic shared].baseUrl = [UserDefaultUtil valueForKey:@"BASEREADDRESS"];
    }
#endif
    
    //高德地图
    [AMapServices sharedServices].apiKey = GAODEMAP_KEY;
    [AMapLocationManager updatePrivacyShow:AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain];
    [AMapSearchAPI updatePrivacyShow:(AMapPrivacyShowStatusDidShow) privacyInfo:(AMapPrivacyInfoStatusDidContain)];
    [AMapSearchAPI updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree];
    [AMapLocationManager updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree];
//    [MAMapView updatePrivacyShow:AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain];

    //极光推送
    [self jPushConfiguration:launchOptions];
    
    //极光统计（崩溃日志收集）
    [self jCrashLogsConfiguration:launchOptions];
    
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    [self.window makeKeyAndVisible];
    self.window.rootViewController = [[MCTabBarController alloc] init];
    
    if (TOKEN_ISEMPTY) {
        [UserDefaultUtil saveValue:@"" forKey:USER_TOKEN];
    }
    [UserDefaultUtil saveValue:@116.4 forKey:LONGITUDE];
    [UserDefaultUtil saveValue:@39.9 forKey:LATITUDE];
    
#ifdef isOpenBaiDuFaceSDK
    //百度活体检测
    NSString* licensePath = [NSString stringWithFormat:@"%@.%@", FACE_LICENSE_NAME, FACE_LICENSE_SUFFIX ];
    [[FaceSDKManager sharedInstance] setLicenseID:FACE_LICENSE_ID andLocalLicenceFile:licensePath andRemoteAuthorize:YES];
    NSLog(@"canWork = %d",[[FaceSDKManager sharedInstance] canWork]);   //1: 成功  0:失败
    NSLog(@"version = %@",[[FaceSDKManager sharedInstance] getVersion]);    //4.0
    
    [self initSDK];
    [self initLivenesswithList];
#endif
    
    // 强制关闭暗黑模式
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
    if(@available(iOS 13.0,*)){
        self.window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
    }
#endif
    
#ifdef isTestSPT
    [KSPTHandler testSpt];
#endif
    // SPTHandler初始化
    [SPTHandler sharedSPTHandler];
    
    return YES;
}

- (void)jPushConfiguration:(NSDictionary *)launchOptions {
    
    //Required
    //notice: 3.0.0 及以后版本注册可以这样写，也可以继续用之前的注册方式
    JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init];
    if (@available(iOS 12.0, *)) {
        entity.types = JPAuthorizationOptionAlert|JPAuthorizationOptionBadge|JPAuthorizationOptionSound|JPAuthorizationOptionProvidesAppNotificationSettings;
    } else {
        // Fallback on earlier versions
    }
    if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
        // 可以添加自定义 categories
        // NSSet<UNNotificationCategory *> *categories for iOS10 or later
        // NSSet<UIUserNotificationCategory *> *categories for iOS8 and iOS9
    }
    [JPUSHService registerForRemoteNotificationConfig:entity delegate:self];
    
    //如不需要使用IDFA，advertisingIdentifier 可为nil
    [JPUSHService setupWithOption:launchOptions appKey:JIGUANG_APPKEY
                          channel:@"APP Store"
                 apsForProduction:YES
            advertisingIdentifier:nil];
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler{
    if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
        NSURL *url = userActivity.webpageURL;
    if (url) {
          //进行我们的处理
    } else {
        [[UIApplication sharedApplication] openURL:url];
    }
    }
    return YES;
}

- (void)jCrashLogsConfiguration:(NSDictionary *)launchOptions {
    
    JANALYTICSLaunchConfig * config = [[JANALYTICSLaunchConfig alloc] init];
    
    config.appKey = JIGUANG_APPKEY;
    
    config.channel = @"APP Store";
    
    [JANALYTICSService setupWithConfig:config];
    
    [JANALYTICSService crashLogON];
}

- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    
    /// Required - 注册 DeviceToken
    [JPUSHService registerDeviceToken:deviceToken];
}


#pragma mark- JPUSHRegisterDelegate
// iOS 12 Support
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center openSettingsForNotification:(UNNotification *)notification API_AVAILABLE(ios(10.0)){
    if (notification && [notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
        //从通知界面直接进入应用
    }else{
        //从通知设置界面进入应用
    }
}

// iOS 10 Support
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler  API_AVAILABLE(ios(10.0)) {
    // Required
    NSDictionary *userInfo = notification.request.content.userInfo;
    if([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
        [JPUSHService handleRemoteNotification:userInfo];
    }
    
    NSLog(@"userInfo = %@", userInfo);
    
    if ([userInfo[@"type"] isEqual:NOTICE_ORDER_DISPATCH_OLD]) {
        // 调出
        [KNotificationCenter postNotificationName:YUNDANCENTERLIST_REFRESH object:nil];
        [KSPTHandler getOrderDetailWithCode:userInfo[@"shippingNoteNumber"] stage:SPTStagePause remark:@"[03]运单被调出"];
        
    }
    if ([userInfo[@"type"] isEqual:NOTICE_ORDER_DISPATCH_NEW]) {
        // 调入
        [KNotificationCenter postNotificationName:YUNDANCENTERLIST_REFRESH object:nil];
        [KSPTHandler getOrderDetailWithCode:userInfo[@"shippingNoteNumber"] stage:SPTStageRestart remark:@"[02]运单被调入"];
        
    }
    if ([userInfo[@"type"] isEqual:NOTICE_ORDER_DELETE]) {
        // 删除 取消 后台卸货
        [KSPTHandler getOrderDetailWithCode:userInfo[@"shippingNoteNumber"] stage:SPTStageStop remark:@"[01]运单被删除 运单后台卸货"];
        
    }
    if ([userInfo[@"type"] isEqual:NOTICE_ORDER_SERVICE_STARTED]) {
        // 后台装货
        [KSPTHandler getOrderDetailWithCode:userInfo[@"shippingNoteNumber"] stage:SPTStageStart remark:@"[00]运单后台装货"];
        
    }
    if ([userInfo[@"type"] isEqual:SPT_UPDATE_INFO]) {
        // 更新车牌、姓名
        [KSPTHandler updateUserInfo];
    }
    
    NSString *uuid = [DCSpeedy getUUID];
    if ([userInfo[@"type"] isEqual:NOTICE_OTHER_DEVICE_LOGIN] && ![userInfo[@"deviceId"] isEqualToString:uuid]) {
        // 其他设备登录
        [KNotificationCenter postNotificationName:LOGIN_LOGOUT object:@"[03]换手机"];
        
        [UserDefaultUtil saveValue:@"" forKey:USER_TOKEN];
        [JPUSHService deleteAlias:nil seq:1];
        [JPUSHService cleanTags:nil seq:1];
        [DCSpeedy judgeUserIsLogin];
    }
    
    completionHandler(UNNotificationPresentationOptionAlert); // 需要执行这个方法，选择是否提醒用户，有 Badge、Sound、Alert 三种类型可以选择设置
    
    if ([DCSpeedy isBlankString:[NSString nullToString:CJStringWithFormat(@"%@", userInfo[@"isSystem"])]] == NO) {
        
        NSFileManager *fileManager = [NSFileManager defaultManager];
        
        NSString *filePath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"JPushNotice.plist"];
        
        NSMutableDictionary *dict = [NSMutableDictionary dictionary];
        if ([userInfo[@"isSystem"] integerValue] == 1 || [DCSpeedy isBlankString:userInfo[@"type"]] == YES) {
            //系统消息
            //            [dict setObject:userInfo[@"type"] forKey:@"type"];
            [dict setObject:userInfo[@"aps"][@"alert"] forKey:@"content"];
            [dict setObject:@"1" forKey:@"isSystem"];
            [dict setObject:userInfo[@"pushTime"] forKey:@"pushTime"];
            //            [dict setObject:[DCSpeedy currentDate] forKey:@"pushTime"];
            
        } else {
            //非系统消息
            [dict setObject:userInfo[@"type"] forKey:@"type"];
            [dict setObject:userInfo[@"aps"][@"alert"] forKey:@"content"];
            [dict setObject:@"0" forKey:@"isSystem"];
            [dict setObject:userInfo[@"pushTime"] forKey:@"pushTime"];
            [dict setObject:userInfo[@"params"] forKey:@"params"];
        }
        
        
        if ([fileManager fileExistsAtPath:filePath] == NO) {
            //不存在
            NSMutableArray *dataArr = [[NSMutableArray alloc] init];
            [dataArr addObject:dict];
            
            [dataArr writeToFile:filePath atomically:YES];
            
        } else {
            
            NSMutableArray *array = [[NSMutableArray alloc] initWithContentsOfFile:filePath];
            if (array.count < 100) {
                [array addObject:dict];
            } else {
                [array removeObject:array.lastObject];
                [array addObject:dict];
            }
            
            [array writeToFile:filePath atomically:YES];
        }
    }
    
}

// iOS 10 Support---点击通知栏横幅调用
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler  API_AVAILABLE(ios(10.0)){
    // Required
    NSDictionary * userInfo = response.notification.request.content.userInfo;
    
    NSLog(@"--推送消息---%@",userInfo);
    
    if([response.notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
        [JPUSHService handleRemoteNotification:userInfo];
    }
    
    [UIApplication sharedApplication].applicationIconBadgeNumber=0;
    [JPUSHService resetBadge];//清空JPush服务器中存储的badge值
    
    completionHandler();  // 系统要求执行这个方法
    
    //这里可以根据收到的推送内容来跳转到指定的地方；
    [self mastePushViewController:userInfo];
}

//push方法
- (void)mastePushViewController:(NSDictionary *)infoDic {
    /*
     在这里我们需要进行跳转到指定页面的处理。那么就有一个问题，我们的项目工程里有的页面是presented出来的，那么久无法进行push。那么这里我们就要进行找topVC,并且这个topVC是需要我们进行处理的，是需要具有导航的（navigationController）。
     */
    
    //找当前VC
    UIViewController *currentVC = [self getcurrentTopViewController];
    NSLog(@"controllerName=%@",NSStringFromClass([currentVC class]));
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        //跳转到指定页面
        //        [currentVC.navigationController pushViewController:currentVC animated:YES];
        
        UIViewController * currentVC = [self getcurrentTopViewController];
        
        NSLog(@"controllerName=%@",NSStringFromClass([currentVC class]));
        
        MCTabBarController *tab = (MCTabBarController *)(self.window.rootViewController);
        XPRootNavigationController *nav = tab.viewControllers[tab.selectedIndex];
        
        
        if ([infoDic[@"type"] isEqual: NOTICE_HUOYUANDETAIL] && [infoDic[@"isSystem"] integerValue] == 0) {
            //货源单详情
            if ([DCSpeedy isBlankString: infoDic[@"params"]] == NO) {
                
                NSInteger codeLength = [infoDic[@"params"] length];
                NSString *orderCode = [infoDic[@"params"] substringWithRange:NSMakeRange(5, codeLength - 5)];
                
                HuoYuanDetailViewController *hydvc = [[HuoYuanDetailViewController alloc] init];
                hydvc.orderCode = orderCode;
                [nav pushViewController:hydvc animated:YES];
            }
            
        } else if ([infoDic[@"isSystem"] integerValue] == 1 || [DCSpeedy isBlankString:infoDic[@"type"]] == YES) {
            //系统消息
            NoticeMessageViewController *nmvc = [[NoticeMessageViewController alloc] init];
            [nav pushViewController:nmvc animated:YES];
            
        } else if ([infoDic[@"type"] isEqual:NOTICE_YUNDANDETAIL] ) {
            
            NSInteger codeLength = [infoDic[@"params"] length];
            NSString *orderCode = [infoDic[@"params"] substringWithRange:NSMakeRange(5, codeLength - 5)];
            YunDanCenterDetailViewController *ydcdvc = [[YunDanCenterDetailViewController alloc] init];
            ydcdvc.orderCode = orderCode;
            [nav pushViewController:ydcdvc animated:YES];
            
        } else if ([infoDic[@"type"] isEqual:NOTICE_YUNDANLIST_CANCEL] ) {
            
            YunDanCenterTabbar *ydctb = [[YunDanCenterTabbar alloc] init];
            ydctb.selectedIndex = 6;
            [nav pushViewController:ydctb animated:YES];
            
        } else if ([infoDic[@"type"] isEqual:NOTICE_YUNDANLIST_ALL] ) {
            
            YunDanCenterTabbar *ydctb = [[YunDanCenterTabbar alloc] init];
            ydctb.selectedIndex = 0;
            [nav pushViewController:ydctb animated:YES];
            
        } else if ([infoDic[@"type"] isEqual:NOTICE_ORDER_DISPATCH_OLD]) {
            
            [KSPTHandler getOrderDetailWithCode:infoDic[@"shippingNoteNumber"] stage:SPTStagePause remark:@"[03]运单被调出"];
            
            YunDanCenterTabbar *ydctb = [[YunDanCenterTabbar alloc] init];
            ydctb.selectedIndex = 3;
            [nav pushViewController:ydctb animated:YES];
            
        } else if ([infoDic[@"type"] isEqual:NOTICE_ORDER_DISPATCH_NEW] ) {
            // 调入
            NSString *orderCode = infoDic[@"params"][@"code"];
            YunDanCenterDetailViewController *ydcdvc = [[YunDanCenterDetailViewController alloc] init];
            ydcdvc.orderCode = orderCode;
            [nav pushViewController:ydcdvc animated:YES];
            
        } else if ([infoDic[@"type"] isEqual:SPT_UPDATE_INFO]) {
            // 更新车牌、姓名
            [KSPTHandler updateUserInfo];
            
        } else if ([infoDic[@"type"] isEqual:NOTICE_OTHER_DEVICE_LOGIN] && [infoDic[@"deviceId"] isEqualToString:[DCSpeedy getUUID]]) {
            // 其他设备登录
            [KNotificationCenter postNotificationName:LOGIN_LOGOUT object:@"[03]换手机"];
        }
        
    });
}

//找到当前视图控制器
- (UIViewController *)getcurrentTopViewController {
    UIViewController *blockViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
    
    while (blockViewController.presentedViewController) {
        
        blockViewController = blockViewController.presentedViewController;
        
    }
    
    if (![blockViewController isKindOfClass:[UITabBarController class]] &&
        
        ![blockViewController isKindOfClass:[UINavigationController class]]) {
        
        UIViewController *currentChildVC;
        
        if (blockViewController.childViewControllers.count) {
            
            currentChildVC = blockViewController.childViewControllers.lastObject;
            
        }
        
        while (currentChildVC) {
            
            blockViewController = currentChildVC;
            
            if ([blockViewController isKindOfClass:[UITabBarController class]]) {
                
                blockViewController = [(UITabBarController *)blockViewController selectedViewController];
                
            }
            
            if ([blockViewController isKindOfClass:[UINavigationController class]]) {
                
                blockViewController = [(UINavigationController *)blockViewController topViewController];
                
            }
            
        }
        
    }
    
    if ([blockViewController isKindOfClass:[UITabBarController class]]) {
        
        blockViewController = [(UITabBarController *)blockViewController selectedViewController];
        
    }
    
    
    
    if ([blockViewController isKindOfClass:[UINavigationController class]]) {
        
        blockViewController = [(UINavigationController *)blockViewController topViewController];
        
    }
    
    return blockViewController;
    
}

- (void)jpushNotificationAuthorization:(JPAuthorizationStatus)status withInfo:(NSDictionary *)info {
    
}


- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    
    // Required, iOS 7 Support
    [JPUSHService handleRemoteNotification:userInfo];
    completionHandler(UIBackgroundFetchResultNewData);
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    
    // Required, For systems with less than or equal to iOS 6
    [JPUSHService handleRemoteNotification:userInfo];
}

- (void)openURL:(NSURL*)url options:(NSDictionary<UIApplicationOpenExternalURLOptionsKey, id> *)options completionHandler:(void (^ __nullable)(BOOL success))completion NS_AVAILABLE_IOS(10_0) NS_EXTENSION_UNAVAILABLE_IOS("") {
    
}
//- (BOOL)application:(UIApplication *)application
//        openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
//    NSString *handleUrl = [url absoluteString];
//    if ([handleUrl isEqualToString:@"iOSDevTip"]) {
//        return YES;
//    }
//    return YES;
//}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    [UIApplication sharedApplication].applicationIconBadgeNumber=0;
    
    [JPUSHService setBadge:0];
    
#ifdef isProductionEnvironment
    [[CJCheckVersion shareCheckVersion] checkVersion];
#endif
    
}


- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

#ifdef isOpenBaiDuFaceSDK
#pragma mark - UI Action
- (void) initSDK {
    
    // 初始化SDK配置参数，可使用默认配置
    // 设置最小检测人脸阈值
    [[FaceSDKManager sharedInstance] setMinFaceSize:200];
    // 设置截取人脸图片高
    [[FaceSDKManager sharedInstance] setCropFaceSizeWidth:400];
    // 设置截取人脸图片宽
    [[FaceSDKManager sharedInstance] setCropFaceSizeHeight:640];
    // 设置人脸遮挡阀值
    [[FaceSDKManager sharedInstance] setOccluThreshold:0.5];
    // 设置亮度阀值
    [[FaceSDKManager sharedInstance] setIllumThreshold:40];
    // 设置图像模糊阀值
    [[FaceSDKManager sharedInstance] setBlurThreshold:0.3];
    // 设置头部姿态角度
    [[FaceSDKManager sharedInstance] setEulurAngleThrPitch:10 yaw:10 roll:10];
    // 设置人脸检测精度阀值
    [[FaceSDKManager sharedInstance] setNotFaceThreshold:0.6];
    // 设置抠图的缩放倍数
    [[FaceSDKManager sharedInstance] setCropEnlargeRatio:3.0];
    // 设置照片采集张数
    [[FaceSDKManager sharedInstance] setMaxCropImageNum:6];
    // 设置超时时间
    [[FaceSDKManager sharedInstance] setConditionTimeout:15];
    // 设置开启口罩检测，非动作活体检测可以采集戴口罩图片
    [[FaceSDKManager sharedInstance] setIsCheckMouthMask:true];
    // 设置开启口罩检测情况下，非动作活体检测口罩过滤阈值，默认0.8 不需要修改
    [[FaceSDKManager sharedInstance] setMouthMaskThreshold:0.8f];
    // 设置原始图缩放比例
    [[FaceSDKManager sharedInstance] setImageWithScale:0.8f];
    // 设置图片加密类型，type=0 基于base64 加密；type=1 基于百度安全算法加密
    [[FaceSDKManager sharedInstance] setImageEncrypteType:0];
    // 初始化SDK功能函数
    [[FaceSDKManager sharedInstance] initCollect];
    
    
}

- (void)initLivenesswithList {
    // 默认活体检测打开，顺序执行
    [BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLiveEye)];
    [BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLiveMouth)];
    [BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLiveYawRight)];
    [BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLiveYawLeft)];
    //    [BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLivePitchUp)];
    //    [BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLivePitchDown)];
    //    [BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLiveYaw)];
    BDFaceLivingConfigModel.sharedInstance.isByOrder = YES;
    BDFaceLivingConfigModel.sharedInstance.numOfLiveness = 4;
}
#endif

@end
